<template>
    <view class="container">
        <view class="list">
            <view class="title">共计{{ data.length }}笔{{ type == 0 ? "采购" : "退货" }}单</view>
            <view class="flex-between listmain" @click="goUrl(item.ID)" v-for="(item, index) in data" :key="index">
                <view class="flex-between flex-left">
                    <view class="index">{{ index + 1 }}</view>
                    <view v-if="type == 0">{{ item.OrderNo }}</view>
                    <view v-else="type == 0">{{ item.OutTradeNo }}</view>
                </view>
                <view class="strong flex-between"
                    ><view>{{ item.PriceSum }}元</view
                    ><uni-icons type="arrowright" size="20" customIcons="icon-gray-1"></uni-icons
                ></view>
            </view>
        </view>
    </view>
</template>

<script>
import { GetBuyOrderById } from "@/pages_supplier/service/api/buyOrder.js"
import imgItem from "@/pages_supplier/components/form/img-item.vue"
export default {
    components: {
        imgItem,
    },
    data() {
        return {
            data: [],
            type: "",
        }
    },
    onLoad(e) {
        this.data = JSON.parse(e.data)
        console.log(this.data)
        this.type = e.type
    },
    mounted() {
        if (this.type == 0) {
            uni.setNavigationBarTitle({
                title: "关联采购单",
            })
        } else {
            uni.setNavigationBarTitle({
                title: "关联退货单",
            })
        }
    },
    methods: {
        goUrl(ID) {
            if (this.type == 0) {
                this.easyGoTo("/pages_supplier/packet/order/orderDetail?id=" + ID)
            } else {
                this.easyGoTo("/pages_supplier/packet/returnOrder/detail?id=" + ID)
            }
        },
    },
}
</script>

<style lang="scss" scoped>
.container {
    padding: $app-item-padding;
}

.list {
    padding: 4rpx 16rpx 32rpx 16rpx;
    .title {
        font-size: 28rpx;
        font-weight: bold;
        color: $color-gray-1;
        padding-top: 28rpx;
    }
    .listmain {
        height: 98rpx;
        font-size: 28rpx;
        color: $color-gray-1;
        border-bottom: 2rpx solid #ebebeb;
    }
    .index {
        width: 75rpx;
        font-weight: bold;
    }
    .strong {
        font-size: 32rpx;

        & > view {
            padding-right: 24rpx;
            font-weight: bold;
        }
    }
}
.footer {
    width: 750rpx;
    height: 120rpx;
    background: #ffffff;
    box-shadow: 0px -2rpx 6rpx 0px rgba(0, 0, 0, 0.1);
    position: fixed;
    left: 0;
    bottom: 0;

    .btn {
        margin: 16rpx 30rpx 0 30rpx;
    }
}
</style>
